package cn.tedu.demo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.io.Serializable;

@Component
public class Worker implements Serializable {
    private String name = "光头强";

    public Saw saw;

    @Autowired
    public void setSaw(Saw saw) {
        this.saw = saw;
        System.out.println("setSaw()");
    }

    public void work() {
        System.out.println(name + "使用" + saw + "砍树");
    }
}
